<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:insert="~{include :: header('课程评论列表')}" />
    <th:block th:insert="~{include :: bootstrap-table-css}" />
</head>
<body class="hold-transition">
<div class="container-fluid mb-2">
    <input type="hidden" id="OtherId" th:value="*{otherId}">
    <input type="hidden" id="commentType" th:value="*{typeId}">
    <table id="bootstrap-table" class="table-striped"></table>
</div>
<th:block th:insert="~{include :: footer}" />
<th:block th:insert="~{include :: bootstrap-table-js}" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('comment:edit')}]];
    var removeFlag = [[${@permission.hasPermi('comment:remove')}]];
    var prefix = "/comment";
    var otherId =$("#OtherId").val();
    var typeId =$("#commentType").val();

    $(function() {
        var options = {
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            url: prefix + "/list.json?otherId="+otherId+"&typeId="+typeId,
            removeUrl: prefix + "/remove.json",
            modalName: "课程评论",
            columns: [
                {
                    field: 'commentId',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '昵称'
                },
                {
                    field: 'mobile',
                    title: '手机'
                },
                {
                    field: 'content',
                    title: '评论内容'
                },
                {
                    field: 'addTime',
                    title: '评论时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="commentInfo(\'' + row.commentId + '\')"><i class="fa fa-search"></i>详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    //评论详情
    function commentInfo(id) {
        layer.open({
            type: 2,
            maxmin: false,
            shade: 0.3,
            title: "评论详细",
            fix: false,
            area: ['70%', '90%'],
            content: "/comment/view.html?id="+id
        });
    }
</script>
</body>
</html>